import {reqTradeInfo} from '@/api'

const state = {
    tradeInfo : {}
}

const mutations = {
    REVEICE_TRADEINFO(state,tradeInfo){
        state.tradeInfo = tradeInfo
    }
}

const actions = {
    async getTradeInfo({commit}){
        const result = await reqTradeInfo()
        if (result.code === 200) {
            commit('REVEICE_TRADEINFO',result.data)
        }
    }
}

const getters = {
    detailArrayList(state){
        return state.tradeInfo.detailArrayList || []
    }
}

export default {
    state,
    mutations,
    actions,
    getters
}